package cn.youruan.demo.controller;

import cn.youruan.demo.common.R;
import cn.youruan.demo.domain.Hobby;
import cn.youruan.demo.domain.Log;
import cn.youruan.demo.service.IHobbyService;
import cn.youruan.demo.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/hobby")
@Slf4j
public class HobbyController {
    @Autowired
    private IHobbyService hobbyService;

    @Autowired
    private IUserService userService;

    @PostMapping("/add")
    public R<String> add(@RequestBody Hobby hobby,Long userId) {
        hobbyService.addHobby(hobby,userId);
        return R.success("爱好添加成功!!!");
    }

    @DeleteMapping("/delete")
    public R<String> delete(Long userId,Long hobbyId) {
        hobbyService.removeHobbyById(userId,hobbyId);
        return R.success("爱好删除成功!!!");
    }
}
